import mongoose from '../config/DBHelpler'

const Schema = mongoose.Schema

const CollectSchema = new mongoose.Schema({
  uid: { type: String },
  tid: { type: String },
  title: { type: String },
  created: { type: Date },
})

CollectSchema.statics = {
  findByCoid: function (id, cuid) {
    return this.find({ tid: id, uid: cuid })
  },
}

const Collect = mongoose.model('user_collect', CollectSchema)

export default Collect
